package com.szx.ssm.controller;

import com.szx.ssm.bean.Msg;
import com.szx.ssm.bean.tbDept;
import com.szx.ssm.servlet.tbDepServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author songzx
 * @create 2022-07-03 9:05
 */
@Controller
public class DeptController {
    @Autowired
    tbDepServlet depServlet;

    /**
     * 获取所有部门
     * @author Songzx
     * @date 2022/7/3
     */
    @GetMapping("/getDeptList")
    @ResponseBody
    public Msg getDeptList(){
        List<tbDept> deptList = depServlet.getDeptList();
        Msg msg = Msg.success().add("deptList", deptList);
        return msg;
    }
}
